import { takeEvery, put } from 'redux-saga/effects'
import axios from 'axios'
import { fromJS } from 'immutable'
import {loadDataSync} from './actionCreator'

function* loadDataTeamHome(action) {
    const result = yield axios.get(
        '/api/doctorTeam?id=' + action.id
    )
    yield put(loadDataSync(fromJS(result.data[0])))
}

function* TeamHomeSaga() {
    yield takeEvery('loadDataTeamHomeSaga', loadDataTeamHome)
}

export default TeamHomeSaga